#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
# check root
[[ $EUID -ne 0 ]] && echo -e "${red}错误: ${plain} 必须使用root用户运行此脚本！\n" && exit 1

# check os
if [[ -f /etc/redhat-release ]]; then
    release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
    release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
    release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
    release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
    release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
    release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
    release="centos"
else
    echo -e "${red}未检测到系统版本，请联系脚本作者！${plain}\n" && exit 1
fi


show_menu() {
    echo -e "
  ${green}0.${plain} 退出脚本
————————————————
  ${green}1.${plain} 一键v2-ui（包含trojan）
————————————————
  ${green}2.${plain} 一键bbr (最新内核)
————————————————
  ${green}3.${plain} 一键dd重装系统
————————————————
  ${green}4.${plain} 一键ssr
————————————————
  ${green}5.${plain} 一键gost
————————————————
  ${green}6.${plain} 一键中转
————————————————
  ${green}7.${plain} 一键jd-unicom
————————————————
  ${green}8.${plain} 一键cns
 "
    echo && read -p "请输入选择 [0-8]: " num

    case "${num}" in
        0) exit 0
        ;;
        1) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/v2-ui/v2-ui.sh)
        ;;
        2) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/bbr/bbr.sh)
        ;;
        3) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/dd/dd.sh)
        ;;
        4) wget https://gitee.com/azsummer/jd-base/raw/master/ssr/ssr.zip && unzip ssr.zip && bash install.sh
        ;;
        5) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/gost/gost.sh)
        ;;
        6) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/iptablesUtils/natcfg.sh)
        ;;
        7) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/jd-unicom/jd3.25.sh)
        ;;
		8) bash <(curl -Ls https://gitee.com/azsummer/jd-base/raw/master/clnc/clncv2.sh)
        ;;
        *) echo -e "${red}请输入正确的数字 [0-8]${plain}"
        ;;
    esac
}

show_menu